export default{
    namespaced:true,
    state:{
        //登录态token
        token:''
    },
    getters:{
        isLogin:(state)=>{
            return !!state.token || !!localStorage.getItem('pm_token')
        }
    },
    mutations:{
        setToken(state,token){
            //保存在localStorage
            localStorage.setItem('pm_token',token);
            state.token = token;
        },
        clearToken(state){
            state.token=''
            localStorage.removeItem('pm_token');
        },
    }
}